﻿
-- =============================================
-- Author:		<赵洪涛>
-- Create date: <2012-04-14>
-- Description:	<驳回成单变更>
-- =============================================
CREATE PROCEDURE [dbo].[proc_Order_Change_Shenhe]
(
		@CId int
		,@OId uniqueidentifier
		,@shpjg	int
		,@shpyj	nvarchar(400)
		,@shpr	nvarchar(50)
	)
AS
Begin Tran
	Insert Into Order_Change_Audit(CId,OId,shpr,shpyj) Values(@CId,@OId,@shpr,@shpyj)		--审核日志
	Delete From Order_Change_Project Where CId=@CId And OId=@OId
	Delete From Order_Change_Item Where CId=@CId And OId=@OId
	Update Order_Change Set flag=@shpjg Where Id=@CId And OId=@OId

   If @@error <> 0  --发生错误
		Begin
			RollBack Tran
			Return
		End
    Else
		Begin
			Commit Tran
			Return    --执行成功
End